﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<AptitudePrintFormViewModel>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>AptitudePrintForm</title>
    <link rel="stylesheet" type="text/css" href='<%= Url.Content("~/App_Themes/Default/Print.css") %>' />
</head>
<body onload="window.print()">
    <div>
        <% if (Model.Examinations.Count == 0)
           { %>
        <%: Resources.Global.NoExaminationsToPrintMessage %>
        <% } %>
        <% int i = 0; foreach (Examination examination in Model.Examinations)
           { %>
        <table cellpadding="0" cellspacing="0" class="main-table">
            <tr>
                <td class="center-aligned simple-border bold width-400">
                    <%: Model.HostCompany.Name%>
                    <br />
                    <%: Resources.Global.MedicalOfficeHeader%>
                </td>
                <td class="center-aligned simple-border bold width-400">
                    <% if (Model.HostCompany.address != null)
                       { %>
                    <%: Model.HostCompany.address.City.DefaultIfNull("___").ToUpper()%>,
                    <%: Resources.Global.StreetAbreviationLabel.ToUpper()%>
                    <%: Model.HostCompany.address.Street.DefaultIfNull("___").ToUpper()%>,
                    <br />
                    <%: Resources.Global.NumberAbreviationLabel%>
                    <%: Model.HostCompany.address.Number%>,
                    <%: Model.HostCompany.address.Details.DefaultIfNull("___").ToUpper()%>
                    <br />
                    <%: Resources.Global.TelFaxAbreviationLabel.ToUpper()%>
                    <%: Model.HostCompany.address.Phone.DefaultIfNull("___").ToUpper()%>
                    /
                    <%: Model.HostCompany.address.Fax.DefaultIfNull("___").ToUpper()%>
                    <%} %>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="center-aligned">
                    <div class="examinationtypes">
                        <% int j = 1;
                           foreach (ExaminationType examinationType in Model.ExaminationTypes)
                           { %>
                        <div class="examinationtype">
                            <%= Html.Label(examinationType.Name)%>
                            <%= Html.CheckBox("examinationType", examinationType.ID == examination.ExaminationTypeID, new { @class = "bottom-aligned" })%>
                        </div>
                        <% if ((j % 4) == 0)%>
                        <br />
                        <% j++;
                           } %>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="center-aligned">
                    <div id="title" class="bold">
                        <%: Resources.Global.AptitudePrintFormTitle%>
                        <%: examination.ID %>
                    </div>
                    <div id="subtitle">
                        <%: Resources.Global.AptitudePrintFormSubtitle%>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="bold">
                                <%: Resources.Global.Company2Label%>
                            </td>
                            <td class="containerwide">
                                &nbsp;<%: examination.employee.company.Name%>
                            </td>
                        </tr>
                    </table>
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="bold">
                                <%: Resources.Global.AddressLabel%>
                            </td>
                            <td class="containerwide">
                                &nbsp;<%: examination.employee.company.address != null ? examination.employee.company.address.FullAddress : string.Empty%>
                            </td>
                        </tr>
                    </table>
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="bold">
                                <%: Resources.Global.PhoneLabel%>
                            </td>
                            <td class="containerwide">
                                &nbsp;<%: examination.employee.company.address != null ? examination.employee.company.address.Phone : string.Empty%>
                                /
                                <%: examination.employee.company.address != null ? examination.employee.company.address.Fax : string.Empty%>
                            </td>
                        </tr>
                    </table>
                    <div class="person-info-container">
                        <table cellpadding="0" cellspacing="0" class="containerwide">
                            <tr>
                                <td style="width: 250px">
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="bold">
                                                <%: Resources.Global.FirstNameLabel.ToUpper()%>
                                            </td>
                                            <td class="bottom-dashed-cell containerwide">
                                                &nbsp;<%: examination.employee.person.FirstName%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td>
                                    <table>
                                        <tr>
                                            <td class="bold">
                                                <%: Resources.Global.LastNameLabel.ToUpper()%>
                                            </td>
                                            <td class="bottom-dashed-cell containerwide">
                                                &nbsp;<%: examination.employee.person.LastName%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="bold">
                                    <%: Resources.Global.CNPLabel.ToUpper()%>
                                </td>
                                <td class="bottom-dashed-cell containerwide">
                                    &nbsp;<%: examination.employee.person.CNP%>
                                </td>
                            </tr>
                        </table>
                        <table cellpadding="0" cellspacing="0" class="containerwide">
                            <tr>
                                <td style="width: 250px">
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="bold">
                                                <%: Resources.Global.OccupationLabel.ToUpper()%>
                                            </td>
                                            <td class="containerwide">
                                                &nbsp<%: examination.employee.Occupation%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td>
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="bold">
                                                <%: Resources.Global.WorkPlaceLabel.ToUpper()%>
                                            </td>
                                            <td class="containerwide">
                                                &nbsp;<%: examination.employee.WorkPlace%>ab
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div style="clear: both">
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table cellpadding="0" cellspacing="0" class="medicaladvicecontainer containerwide">
                        <tr>
                            <td class="medicaladvices bold">
                                <span id="medicaladvicetitle">
                                    <%: Resources.Global.MedicalAdviceLabel.ToUpper()%>
                                </span>
                                <% Html.Telerik().Grid(Model.MedicalAdvices).Name("MedicalAdvices")
                                    .Columns(columns =>
                                        {
                                            columns.Bound(o => o.Name).HeaderHtmlAttributes(new { style = "display: none" });
                                            columns.Template(o =>
                                            {
                                %>
                                <input name="checkedRecords" type="checkbox" title="checkedRecords" <%: o.ID == examination.MedicalAdviceID ? "checked='checked'" : string.Empty %> />
                                <% })
                                           .Title("Check").HeaderHtmlAttributes(new { style = "display: none" })
                                           .Width(40)
                                           .HtmlAttributes(new { style = "text-align:center" });
                                        })
                                        .DataKeys(keys => keys.Add(ma => ma.ID))
                                        .Footer(false)
                                        .Selectable()
                                        .Render(); %>
                            </td>
                            <td class="recomandations">
                                <table cellpadding="0" cellspacing="0" class="containerwide">
                                    <tr>
                                        <td colspan="2" class="bold">
                                            <%: Resources.Global.RecomandationsLabel%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td id="recomandations-container">
                                            <%: examination.examinationrecomandations.Select(r => r.recomandation.Name).ToStringEnumeration()%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="bottom-dashed-cell">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="bold">
                    <%: Resources.Global.DateLabel%>
                </td>
                <td class="bold center-aligned">
                    <%: Resources.Global.DoctorLabel%>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <%: examination.Date.ToString(Settings.Default.DateFormat)%>
                </td>
            </tr>
        </table>
        <%
               if (++i != Model.Examinations.Count)
               {%>
        <p style="page-break-before: always" />
        <%} %>
        <%} %>
    </div>
</body>
</html>
